const path = require("path");
function resolve(dir) {
  return path.join(__dirname, dir);
}
//less文件的路径
const myTheme = path.resolve(__dirname, "./src/assets/less/vantChange.less");
//  创建路由别名
module.exports = {
  publicPath: '/server',
  chainWebpack: config => {
    config.resolve.alias
      .set("@", resolve("src"))
      .set("assets", resolve("src/assets"))
      .set("components", resolve("src/components"))
      .set("base", resolve("baseConfig"))
      .set("public", resolve("public"));
  },
  css: {
    loaderOptions: {
        less: {
            modifyVars: {
                hack: `true; @import "${myTheme}";`
            }
        },
    }
  },
  devServer: {
    host: "localhost",
    port: 8081, // 端口号
    https: false, // https:{type:Boolean}
    open: true, 
    proxy: {
      '/api1' :{
        target:'http://161.189.104.71:8888/api/',
        secure: false,
        changeOrigin:true,
        pathRewrite:{
          '^/api1':'/api'
        }
      },
      '/api': {
        // 测试环境
        target: 'https://qiaohuhu.xyz:8000/',  // 接口域名
        secure: false,
        changeOrigin: true,  //是否跨域
        pathRewrite: {
          '^/': '/'   //需要rewrite重写的,
        }
      }
    }
  },
}  

